package com.crb.crm.manage.excel;

import java.util.Arrays;
import java.util.Optional;

/**
 * Package: com.crb.crm.manage.excel
 * Description：
 * Author: huangjian
 * Date:  2020/9/5 17:12
 * Modified By:
 */
public enum  ExcelTemplate {
    SHOP("01","商户","商户上传模板.xlsx"),
    TEMPLATE("02","消息模板","消息模板上传模板.xlsx"),
    SYSTEM_CONFIG("03","数据字典","数据字典上传模板.xlsx"),
    ;
    private String code;
    private String desc;
    private String fileName;

    ExcelTemplate() {
    }

    ExcelTemplate(String code, String desc, String fileName) {
        this.code = code;
        this.desc = desc;
        this.fileName = fileName;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public String getFileName() {
        return fileName;
    }

    public static ExcelTemplate findByTemplateCode(String templateCode){
        Optional<ExcelTemplate> smgTempltete = Arrays.stream(ExcelTemplate.values()).filter(temp->temp.getCode().equals(templateCode)).findFirst();
        return smgTempltete.get();
    }
}
